-
-
Notifications
You must be signed in to change notification settings - Fork 748
fix: Filter the directories/files hashed when using commands with patterns, docs and examples fixes #720
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Previously, the following paths were normalized: the working directory for commands and the path elements when source_path is a list. With this change, the following paths are normalized too: plain paths given as source_path strings, path values of npm_requirements and pip_requirements.
See PR terraform-aws-modules#66 TODO: remove the code and logic for hash_extra_paths?
…ecated attributes with version 6.x of AWS provider
4776bb9 to
784f889
Compare
antonbabenko
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks pretty good! Thanks for tackling this issue.
Could you please explain how to test it? Compare this one to the current version of the module and explain what is expected/fixed (changed or not changed).
|
Thank you for the review and feedback! The fix can be exemplified with this code: and the following steps. With the current version of the module: We can see that ignore.txt is not included in the archive, but changing its content makes the module want to recreate the archive, with a different name, due to the changed hash. With the proposed set of changes: We can see that after changing the content of ignore.txt, the plan shows no changes. I would like to ask what do you think about the On the other hand, for the goal of hashing the content of |
Description
This set of changes does the following:
os.path.normpathto normalize other paths used as input to the prepare steppackage.pyjsencode, when passed from Terraform to pythonMotivation and Context
When commands and patterns are used together, the patterns filter is applied when building the archive, but not during the prepare step. Files that are not included in the archive due to the filter are still hashed. If some of those files are generated, with their content depending on the build environment, then, even if the built archives are the same across different build environments, the calculated hashes are not the same and the module wants to create again the archive and redeploy. Making the hashing step take into account the patterns filter fixes #672.
Hashing again the content of
package.pyrestores the logic that was necessary to disable in #66 to fix #63. This time only the content ofpackage.pyis hashed, without its path.The change to normalize other paths used as input with
os.path.normpathis for consistency with existing normalization on some input paths.Breaking Changes
None, but all the hashes will change due to inclusion of
package.pyinto the hashing.How Has This Been Tested?
examples/*to demonstrate and validate my change(s)examples/*projectspre-commit run -aon my pull request